package com.afiorenza;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

import com.afiorenza.two.impl.FibonnaciGenerator;
import com.afiorenza.two.impl.PrimeGenerator;
import com.afiorenza.two.runnable.Consumer;
import com.afiorenza.two.runnable.Productor;

public class ExerciseTwo {
	private static int CANT_NUMEROS = 10;
	private static BlockingQueue<Long> queueFibonacci = new ArrayBlockingQueue<Long>(CANT_NUMEROS * 2);
	private static BlockingQueue<Long> queuePrime = new ArrayBlockingQueue<Long>(CANT_NUMEROS * 2);

	public static void main(String[] args) throws InterruptedException {

		Thread primos = new Thread(new Productor(CANT_NUMEROS, queuePrime, new PrimeGenerator()));
		Thread fibo = new Thread(new Productor(CANT_NUMEROS, queueFibonacci, new FibonnaciGenerator()));

		primos.start();
		fibo.start();

		Thread consumerFibonacci = new Thread(new Consumer(CANT_NUMEROS, queueFibonacci));
		Thread consumerPrime = new Thread(new Consumer(CANT_NUMEROS, queuePrime));
		consumerFibonacci.start();
		consumerPrime.start();

	}
}
